<?php

namespace App\Models;

use App\Models\Base\SchoolUser as BaseSchoolUser;

/**
 * 
 *
 * @property int $id
 * @property int $school_id 学校id
 * @property string $real_name 真实姓名
 * @property string|null $account 账号
 * @property string|null $tel 手机号
 * @property string|null $id_card 身份证号
 * @property bool $enable 是否启用
 * @property string|null $memo 备注
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @property \Illuminate\Support\Carbon|null $deleted_at
 * @property-read \App\Models\School|null $school
 * @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\WorkTicket> $tickets
 * @property-read int|null $tickets_count
 * @method static \Illuminate\Database\Eloquent\Builder|SchoolUser newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|SchoolUser newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|SchoolUser onlyTrashed()
 * @method static \Illuminate\Database\Eloquent\Builder|SchoolUser query()
 * @method static \Illuminate\Database\Eloquent\Builder|SchoolUser whereAccount($value)
 * @method static \Illuminate\Database\Eloquent\Builder|SchoolUser whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|SchoolUser whereDeletedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|SchoolUser whereEnable($value)
 * @method static \Illuminate\Database\Eloquent\Builder|SchoolUser whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|SchoolUser whereIdCard($value)
 * @method static \Illuminate\Database\Eloquent\Builder|SchoolUser whereMemo($value)
 * @method static \Illuminate\Database\Eloquent\Builder|SchoolUser whereRealName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|SchoolUser whereSchoolId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|SchoolUser whereTel($value)
 * @method static \Illuminate\Database\Eloquent\Builder|SchoolUser whereUpdatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|SchoolUser withTrashed()
 * @method static \Illuminate\Database\Eloquent\Builder|SchoolUser withoutTrashed()
 * @mixin \Eloquent
 */
class SchoolUser extends BaseSchoolUser
{
	protected $fillable = [
		self::SCHOOL_ID,
		self::REAL_NAME,
		self::ACCOUNT,
		self::TEL,
		self::ID_CARD,
		self::ENABLE,
		self::MEMO
	];

	public function tickets()
	{
		return $this->hasMany(WorkTicket::class, WorkTicket::SCHOOL_USER_ID, self::ID);
	}

	public function school()
	{
		return $this->belongsTo(School::class, self::SCHOOL_ID);
	}

}
